package academic.nantes.teamsync.customwidget;

import academic.nantes.teamsync.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.TextView;

public class TeamSyncTextView extends TextView {
	
	private boolean isEntete;
	
	public TeamSyncTextView(Context context) {
		super(context);
		isEntete = false;
		init();
		// TODO Auto-generated constructor stub
	}
	
	public TeamSyncTextView(Context context, AttributeSet attrs) {
		super(context, attrs);
		//recup du parametre entete
		TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TeamSyncTable);
		isEntete = a.getBoolean(R.styleable.TeamSyncTable_isEntete, false);
		init();
	}
	
	private void init(){
		if (isEntete){
			this.setBackgroundColor(Color.parseColor("#4083BD"));
			this.setTextColor(Color.parseColor("#FFFFFF"));
		}
		else{
			this.setBackgroundColor(Color.parseColor("#FFFFFF"));
			this.setTextColor(Color.parseColor("#4083BD"));
		}
		this.setGravity(Gravity.CENTER);
	}
	
	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
	}

	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		
	}

}
